<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>	
<%@ taglib prefix="s" uri="/struts-tags"%>
<%@page import="com.yaodian100.mall.member.util.UserData"%>
<%@page import="com.yaodian100.core.common.utils.ServerValue"%>
<%@page import="org.apache.commons.lang.StringUtils"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@taglib uri="http://java.sun.com/jstl/core_rt" prefix="c-rt"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %> 
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>	
<link rel="stylesheet" href="/css/yaodian100_ordercar_v2.css" type="text/css" media="screen" />
<Style>
li.w-1of1{overflow:hidden}
</style>
<!-- 地址选单 -->
<script type="text/javascript" charset="UTF-8" src="/genJS/yaodian_zipCodCode.js"></script>
<script type="text/javascript" charset="UTF-8" src="/genJS/yaodian_zipSevice.js"></script>
<script type="text/javascript" charset="UTF-8" src="/js/jquery.cascade.ext.js"></script>
<script type="text/javascript" charset="UTF-8" src="/js/jquery.cascade.js"></script>
<script type="text/javascript" charset="UTF-8" src="/js/jquery.templating.js"></script>
<script type="text/javascript" charset="UTF-8" src="/js/jquery.alphanumeric.js"></script>
<script type="text/javascript">
	$().ready(function() {	
		//商品重量計算
		$("#showweight").click(function(){
			//立即购买不会有满额购商品
			openDialog("商品重量計算",$("#showWeightDialog").load("<%=ServerValue.getFrontContextPath()%>/shopping/showBuyNowWeight.do?chkInveny=" + $("#chkInveny").val() + "&cartId=${cartId}"),700,500);
		});		
		$("#orderCartDetailOpen").hide();
	    $("#orderCartDetailClose").show();	
	    $("#contactNameTip").hide();
		$("#addrTip").hide();
		$("#telTip").hide();			
		$("#provinceTip").hide();
		$("#paytype30").attr("disabled",true); 
		if($("#contactName").val()==''){
			$("#contactName").val("(请输入收货人姓名)").css("color","#aaa")};

		$("#contactName").focus(function(){
			if($("#contactName").val()=='(请输入收货人姓名)'){
			$("#contactName").val("").css("color","#000")};
		}).blur(function(){
			if($("#contactName").val()==''){
			$("#contactName").val("(请输入收货人姓名)").css("color","#aaa")};
		});

		if($("#addr").val()==''){
			$("#addr").val("(输入街道地址，例如：和平路12巷52号)").css("color","#aaa")};

		$("#addr").focus(function(){
			if($("#addr").val()=='(输入街道地址，例如：和平路12巷52号)'){
			$("#addr").val("").css("color","#000")};
		}).blur(function(){
			if($("#addr").val()==''){
			$("#addr").val("(输入街道地址，例如：和平路12巷52号)").css("color","#aaa")};
		});

		if($("#memo").val()==''){
			$("#memo").val("(非必填项目，可在此说明对商品的特殊需求，我们虽無法保證，但将努力配合您的需求。)").css("color","#aaa")};

		$("#memo").focus(function(){
			if($("#memo").val()=='(非必填项目，可在此说明对商品的特殊需求，我们虽無法保證，但将努力配合您的需求。)'){
			$("#memo").val("").css("color","#000")};
		}).blur(function(){
			if($("#memo").val()==''){
			$("#memo").val("(非必填项目，可在此说明对商品的特殊需求，我们虽無法保證，但将努力配合您的需求。)").css("color","#aaa")};
		});		

		//當客人無帳戶餘額,不可以勾選用我的帳戶餘額
		if(parseFloat($("#myVirtualBalance").text())==0){
			$("#subVrtlBlnc").attr("disabled",true); 
				$("#chkVrtBlnc").attr('disabled',true); 
				$("#paytype40").attr("disabled",true); 
			}
		
		//从收货地址簿选取
		$("#myAddBook").click(function(){
			openDialog("从收货地址簿选取",$("#myAddBookDialog").load("<%=ServerValue.getFrontContextPath()%>/shopping/orderInfo/loadMyAddBook.do"),700,200);			
		});
		//选择折扣礼券
		$("#chkCoupon").click(function(){
			$("#chkBonus").attr('checked', false);
			$("#editBonus").val('0.00');
			$("#offset").text("0元");
			initWallet();
			if (this.checked){
				var tmpIsBuyNow=$("#isBuyNow").val();
				openDialog("选择折扣礼券",$("#myCouponDialog").load("<%=ServerValue.getFrontContextPath()%>/shopping/orderInfo/loadMyCoupon.do?isBuyNow="+tmpIsBuyNow),700,500);
				ProcessCalcuTotal();
			}else{
				$("#editCoupon").val('0.00');
				$("#showCpCode").val("");
				//processBonus(0);
				ProcessCalcuTotal();
			}
		});	

		//耀点100货到付款支援区域
		$("a.cssPayArrive").click(function(){
			openDialog("耀点100货到付款支援区域",$("#divPayArrive").load("/pages/CART/step02_pay_arrive.html"),700,700);			
		});

		//耀点100运费计算标准
		$("#payPortage").click(function(){
			openDialog("耀点100运费计算标准",$("#myAddBookDialog").load("/pages/CART/step02_pay_portage.html"),700,360);			
		});
		
		//选择購物金		
		$("#chkBonus").click(function(){
			initWallet();	
			
			if (this.checked){
				processBonus($("#editCoupon").val());
				ProcessCalcuTotal();
				var iCanUse=parseInt($("#canUse").val(),10);			
				var iOffset=parseInt($("#offset").text().substring(0,$("#offset").text().length-1),10);
				
				if(iCanUse-iOffset<0){
					$("#editBonus").val(parseFloat(iCanUse).toFixed(2));
					
					$("#offset").text(iCanUse+"元");	
					ProcessCalcuTotal();		
				}
				
			}else{
				$("#editBonus").val('0.00');
				ProcessCalcuTotal();
				$("#offset").text("0元");
			}
		});		

		$("#orderCartToggleCloseName").click(function () {
		      $("#orderCartDetailClose").hide();
		      $("#orderCartDetailOpen").show();		      
		});   
		$("#orderCartToggleOpenName").click(function () {		      
		      $("#orderCartDetailOpen").hide();
		      $("#orderCartDetailClose").show();		      
		});	

		$("#zipCode").numeric();
		$("#mobile").numeric();
		$("#areaCode").numeric();
		$("#phone").numeric();
		$("#extension").numeric();
		$("#subVrtlBlnc").numeric({allow:"."});

		if($("#addCmpPd").val()!=""){
			var addCmpPrdArray=$("#addCmpPd").val().split(',');
			$("#tCampP").append("<tr id='trCampP'><td><p>"+addCmpPrdArray[3]+"</p></td>"
					+"<td><span class='type-5'>满额购</span></td>"
					+"<td>"+addCmpPrdArray[4]+"</td>"
					+"<td><div class='t-align-R'>￥"+addCmpPrdArray[2]+"</div></td>"
					+"<td>1</td>"
					+"<td><div class='t-p'>￥"+addCmpPrdArray[2] +"</div>"
					+"<input type='hidden' id='editAmount_x' name='editAmount_x' value='"+addCmpPrdArray[2]+"'/>"
				+"</td></tr>");	
		}

		$("#subVrtlBlnc").change(function() {
			if($("#subVrtlBlnc").val()==""){
				$("#subVrtlBlnc2").val("0.00");
			}else{
				$("#subVrtlBlnc2").val(parseFloat($("#subVrtlBlnc").val()).toFixed(2));
			}
			
		});
		
		function commonTemplate(item) {
			return "<option value='" + item.Value  + "'>" + item.Text + "</option>"; 
		};
		function commonMatch(selectedValue) {
			return this.When == selectedValue; 
		};
		$.each(provinceArray,function(index, item){
		    $("#province").append("<option value='" + item.Value + "'>" + item.Text + "</option>");
		});
		jQuery("#city").cascade("#province",{					
			list : cityArray,				
			template: commonTemplate,
			match: commonMatch 
		}).bind("loaded.cascade",function(e,target) {
            jQuery(this).prepend("<option value='' selected='true'>== 选择城市 ==</option>");
            //jQuery(this).find("option:first")[0].selected = true;	 
		});
		jQuery("#district").cascade("#city",{					
			list: districtArray,
			template: commonTemplate,
			match: commonMatch 
		 }).bind("loaded.cascade",function(e,target) {
	            jQuery(this).prepend("<option value='' selected='true'>== 选择地区 ==</option>");
	            //jQuery(this).find("option:first")[0].selected = true;
     	});  	
			$.each(provinceArray,function(index, item){
				if ( item.Value == "${province}" ){
					$("#province").attr("selectedIndex",index+1);
				}
			});
			$.each(cityArray,function(index, item){
				if ( item.When == "${province}" ){
					$("#city").append("<option value='" + item.Value + "'>" + item.Text + "</option>");
				}
			});
			
			var newCityArray = jQuery.grep(cityArray, function (item) { return item.When == "${province}"; });
			$.each(newCityArray,function(index, item){
				if ( item.Value == "${city}" ){
					$("#city").attr("selectedIndex",index+1);
				}
			});
			
			$.each(districtArray,function(index, item){
				if ( item.When == "${city}" ){
					$("#district").append("<option value='" + item.Value + "'>" + item.Text + "</option>");
				}
			});
			
			newDistrictArray = jQuery.grep(districtArray, function (item) { return item.When == "${city}"; });
			$.each(newDistrictArray,function(index, item){
				var tmpDist="${district}";
				if(tmpDist.substring(0,1)=='※'){
					tmpDist=tmpDist.substring(1);
				}
				if ( item.Value == tmpDist ){
					$("#district").attr("selectedIndex",index+1);
				}
				//if ( item.Value == "${district}" ){
				//	$("#district").attr("selectedIndex",index+1);
				//}
			});	

			$.getJSON("<%=ServerValue.getFrontContextPath()%>/shopping/orderInfo/findLastAddBook.do?type=json",{}
			,function(addBookDataJson){
				if(addBookDataJson!=null){
					$("#contactName").val(addBookDataJson.contactName).css("color","#000");
					$("#addr").val(addBookDataJson.addr).css("color","#000");
					$("#zipCode").val(addBookDataJson.zipCode);								
					if(addBookDataJson.mobile==null){
						$("#mobile").val(" ");
					}else{
						$("#mobile").val(addBookDataJson.mobile);
					}
					if(addBookDataJson.areaCode==null){
						$("#areaCode").val(" ");
					}else{
						$("#areaCode").val(addBookDataJson.areaCode);
					}
					if(addBookDataJson.phone==null){
						$("#phone").val(" ");
					}else{
						$("#phone").val(addBookDataJson.phone);
					}
					if(addBookDataJson.extension==null){
						$("#extension").val(" ");
					}else{
						$("#extension").val(addBookDataJson.extension);
					}
					$.each(provinceArray,function(index, item){
						if ( item.Value == addBookDataJson.province ){
							$("#province").attr("selectedIndex",index+1);
						}
					});
					$("#city").find('option').remove().end();
					$.each(cityArray,function(index, item){
						if ( item.When == addBookDataJson.province ){
							$("#city").append("<option value='" + item.Value + "'>" + item.Text + "</option>");
						}
					});
					var newCityArray = jQuery.grep(cityArray, function (item) { return item.When == addBookDataJson.province; });
					$.each(newCityArray,function(index, item){
						if ( item.Value == addBookDataJson.city ){
							$("#city").attr("selectedIndex",index);
						}
					});
	
					$("#district").find('option').remove().end();
					$.each(districtArray,function(index, item){
						if ( item.When == addBookDataJson.city){
							$("#district").append("<option value='" + item.Value + "'>" + item.Text + "</option>");
						}
					});
					var newDistrictArray = jQuery.grep(districtArray, function (item) { return item.When == addBookDataJson.city; });
					$.each(newDistrictArray,function(index, item){
						var tmpDist=addBookDataJson.district;
						if(tmpDist.substring(0,1)=='※'){
							tmpDist=tmpDist.substring(1);
						}
						if ( item.Value == tmpDist ){
							$("#district").attr("selectedIndex",index);
						}
					});
	
					//判断是否可货到付款
					var tmpCity=$("#city").find('option:selected').val();
					var tmpDistrict=$("#district").find('option:selected').text();
					if(tmpDistrict.substring(0,1)=='※'){
						$("#paytype30").attr("disabled",false); 
					}else{
						$("#paytype30").attr("disabled",true); 
						$("#paytype30").attr("checked",false);
					}								
					//计算运费
					var tmpProvince=$("#province").find('option:selected').val();
					var tmpIsBuyNow=$("#isBuyNow").val();
					var tmpFinalMustPay=$("#editTotalAmount").val();
					var addCmpPd=$("#addCmpPd").val();
					var tmpChkInveny=$("#chkInveny").val();//立即購買
					$.post("<%=ServerValue.getFrontContextPath()%>/shopping/orderInfo/getFreight.do",{codProvince:tmpProvince,isBuyNow:tmpIsBuyNow,finalMustPay:tmpFinalMustPay,addCmpPd:addCmpPd,chkInveny:tmpChkInveny},callback,"json");
					function callback(result){
						$("#spanFreight").text(result);
						$("#editShipFare").val(parseFloat(result).toFixed(2));
						ProcessCalcuTotal();
					}	
					specialMessage();	
				}
			});	

			//全额由我的账户余额付清    
			$('input[id=paytype40]').click(function() {
	            if ($('input[id=paytype40]').is(":checked") == true){
	            	 if(parseFloat($("#finalTotalAmount").val())>=parseFloat($("#myVirtualBalance").text())){
			            	$("#subVrtlBlnc").val(parseFloat($("#myVirtualBalance").text()).toFixed(2));
			               	$("#subVrtlBlnc2").val(parseFloat($("#myVirtualBalance").text()).toFixed(2));
			            }else{
			               	$("#subVrtlBlnc").val(parseFloat($("#finalTotalAmount").val()).toFixed(2));
			               	$("#subVrtlBlnc2").val(parseFloat($("#finalTotalAmount").val()).toFixed(2));
			            }
	            	 $("#chkVrtBlnc").attr("checked",true); 
	            	//$("#chkVrtBlnc").val($("#subVrtlBlnc").val());
	            	 if($("#subVrtlBlnc").val()==""){
		            		$("#chkVrtBlnc").val(0.00);
		    			}else{
		    				$("#chkVrtBlnc").val($("#subVrtlBlnc").val());
		    			}
	               	$("#subVrtlBlnc").attr("disabled",true); 
				}else{
					$("#subVrtlBlnc").val(0.0);  
					$("#subVrtlBlnc2").val(0.0);  
					$("#chkVrtBlnc").val(0.0);  
				}
	            ProcessCalcuTotal();
			});

			$('input[id=paytype10]').click(function() {
	            if ($('input[id=paytype10]').is(":checked") == true){
	            	var numChkVrtBlnc=parseInt($("#chkVrtBlnc").val(),10);
	            	if(numChkVrtBlnc==0){
	            		//$("#subVrtlBlnc").val(0.0);
	            		$("#subVrtlBlnc2").val(0.0);  
						$("#chkVrtBlnc").val(0.0);  
						$("#subVrtlBlnc").attr("disabled",false); 
	            	}else{
	            		$("#subVrtlBlnc").attr("disabled",false); 
	            	}
				}
	            ProcessCalcuTotal();
			});
			$('input[id=paytype20]').click(function() {
	            if ($('input[id=paytype20]').is(":checked") == true){
	            	var numChkVrtBlnc=parseInt($("#chkVrtBlnc").val(),10);
	            	if(numChkVrtBlnc==0){
	            		//$("#subVrtlBlnc").val(0.0); 
	            		$("#subVrtlBlnc2").val(0.0); 
						$("#chkVrtBlnc").val(0.0);  
						$("#subVrtlBlnc").attr("disabled",false); 
	            	}else{
	            		$("#subVrtlBlnc").attr("disabled",false); 
	            	}  
				}
	            ProcessCalcuTotal();
			});
			$('input[id=paytype30]').click(function() {
	            if ($('input[id=paytype30]').is(":checked") == true){
	            	if($("#mobile").val()==""){
	            		alertDialog('填手机号码', '选择货到付款必须填手机号码',"",350,120);
                	}
	            	var numChkVrtBlnc=parseInt($("#chkVrtBlnc").val(),10);
	            	if(numChkVrtBlnc==0){
	            		//$("#subVrtlBlnc").val(0.0);  
	            		$("#subVrtlBlnc2").val(0.0);
						$("#chkVrtBlnc").val(0.0);  
						$("#subVrtlBlnc").attr("disabled",false); 
	            	}else{
	            		$("#subVrtlBlnc").attr("disabled",false); 
	            	}
	            	//是否耀点100货到付款支援区域
	    			serviceSupportMessage();
				}
	            ProcessCalcuTotal();
			});
			$('input[id=paytype50]').click(function() {
	            if ($('input[id=paytype50]').is(":checked") == true){
	            	var numChkVrtBlnc=parseInt($("#chkVrtBlnc").val(),10);
	            	if(numChkVrtBlnc==0){
	            		//$("#subVrtlBlnc").val(0.0);  
	            		$("#subVrtlBlnc2").val(0.0);
						$("#chkVrtBlnc").val(0.0);  
						$("#subVrtlBlnc").attr("disabled",false); 
	            	}else{
	            		$("#subVrtlBlnc").attr("disabled",false); 
	            	} 
				}
	            ProcessCalcuTotal();
			});

			//處理收货人是否輸入
			$("#go_next").click(function() {
				if($("#memo").val()=="(非必填项目，可在此说明对商品的特殊需求，我们虽無法保證，但将努力配合您的需求。)"){
					$("#memo").val("");
				}
				$("#contactNameTip").hide();
				$("#addrTip").hide();
				$("#telTip").hide();	
				$("#provinceTip").hide();
				var inputResult = saveInput("", -1, $("#contactName").attr('value'),$("#province").find('option:selected').text(),$("#city").find('option:selected').text(),$("#district").find('option:selected').text(),$("#addr").attr('value'),$("#zipCode").attr('value'),$("#mobile").attr('value'),$("#areaCode").attr('value'),$("#phone").attr('value'),$("#extension").attr('value'));
				if(inputResult!=null && inputResult[0]=="false"){
					if(inputResult[1]!=""){
						$("#contactNameTip").show();
					}
					if(inputResult[2]!=""){
						$("#addrTip").text(inputResult[2]);
						$("#addrTip").show();
					}
					if(inputResult[3]!=""){
						$("#telTip").text(inputResult[3]);
						$("#telTip").show();
					}	
					if($("#province").find('option:selected').text()=="== 选择省 =="){
						$("#provinceTip").text("请选择省");
						$("#provinceTip").show();
					}
					$("#myAddBook").focus();				
				}else{	
					if($("#province").find('option:selected').text()=="== 选择省 =="){
						$("#provinceTip").text("请选择省");
						$("#provinceTip").show();
						return false;
					}		
					if($("#city").find('option:selected').text()=="== 选择城市 =="){
						$("#provinceTip").text("请选择城市");
						$("#provinceTip").show();
						return false;
					}
					if($("#district").find('option:selected').text()=="== 选择地区 =="){
						$("#provinceTip").text("请选择地区");
						$("#provinceTip").show();
						return false;
					}			
						if ($('input[name=paytype]').is(":checked") == false){
							alert("请选择付款方式");
							return false;
						}
						if($("#useWallet").css("display") != "none"){
							alert("若要使用账户余额，请按「确认使用」按钮，否则请反勾选。");
							return false;
						}	
						
						//if ($("#chkVrtBlnc").attr('checked')){
							//if($("#subVrtlBlnc").val()==""){
			            	///	$("#subVrtlBlnc").val(0.00);
			    		//	}
		                	//$("#chkVrtBlnc").val($("#subVrtlBlnc").val());
		                	//if(parseFloat($("#subVrtlBlnc").val())>parseFloat($("#myVirtualBalance").text())){
							//	alert('账户余额不可大於目前我的账户余额');
							//	return false;
							//}	

		                if ($("#chkVrtBlnc").attr('checked')){
								var tmpSubVB=0.00;
								if($("#subVrtlBlnc").val()==""){
				            		tmpSubVB=$("#subVrtlBlnc").val(0.00);
				    			}else{
				    				tmpSubVB=parseFloat($("#subVrtlBlnc").val()).toFixed(2);
				    			}							
			                	//$("#chkVrtBlnc").val(parseFloat($("#subVrtlBlnc").val()).toFixed(2));
			                	$("#chkVrtBlnc").val(tmpSubVB);
			                	//if(parseFloat($("#subVrtlBlnc").val())>parseFloat($("#myVirtualBalance").text())){
			                	  if(parseFloat(tmpSubVB)>parseFloat($("#myVirtualBalance").text())){
									alert('账户余额不可大於目前我的账户余额');
									return false;
									}		                	
		                } else {
		                	$("#chkVrtBlnc").val(0.0);    
		                };			
		                if ($('input[id=paytype30]').is(":checked") == true){
		                	if($("#mobile").val()==""){
		                		alertDialog('填手机号码', '选择货到付款必须填手机号码',"",350,120);
			                	return false;
		                	}
		                }
		                if ($('input[id=paytype40]').is(":checked") == true){
		                	if(parseFloat($("#finalMustPay").val())>0){
			                	alert('使用全额由我的账户余额付清，但剩余应付金额大于0，请重新选择');
			                	return false;
							}
		                }
		                if(parseFloat($("#finalMustPay").val())<0){
		                	alert('剩余应付金额不可为负，请重新选择');
		                	return false;
						}
		                if(parseFloat($("#finalTotalAmount").val())<0){
		                	alert('订单金额不可为负，请重新选择');
		                	return false;
						} 

		                if(parseFloat($("#finalMustPay").val())==0){
		                	 if ($('input[id=paytype50]').is(":checked") == true){
			                	alert('剩余应付金额为0，不可选网上支付，请重新选择');
			                	return false;
		                	 }
		                	 if ($('input[id=paytype20]').is(":checked") == true){
				                	alert('剩余应付金额为0，不可选邮局汇款，请重新选择');
				                	return false;
			                	 }
		                	 if ($('input[id=paytype10]').is(":checked") == true){
				                	alert('剩余应付金额为0，不可选银行汇款，请重新选择');
				                	return false;
			                	 }
		                	 if ($('input[id=paytype30]').is(":checked") == true){
				                	alert('剩余应付金额为0，不可选货到付款，请重新选择');
				                	return false;
			                	 }
						}
		              	//儲存收件人
		                $.post("<%=ServerValue.getFrontContextPath()%>/member/saveAddressBook.do",{abId:-1,contactName:$("#contactName").attr('value'),province:$("#province").find('option:selected').text(),city:$("#city").find('option:selected').text(),district:$("#district").find('option:selected').text(),zipCode:$("#zipCode").attr('value'),addr:$("#addr").attr('value'),mobile:$("#mobile").attr('value'),areaCode:$("#areaCode").attr('value'),phone:$("#phone").attr('value'),extension:$("#extension").attr('value')},
		    					function callback(result){
									//alert("saveAddressBook_result:"+result);
		    						},
		    					"json");
						
		                var chkInveny=$("#chkInveny").val();
		                $.getJSON("<%=ServerValue.getFrontContextPath()%>/shopping/checkSpecInventoryBuyNow.do",{chkInveny:chkInveny}
						,function(result){	
							if(result!='OK'){// 数量检查
								alert(result);	
								alertDialog("库存不足",result,"",400,200);
							}else{
								$.getJSON("<%=ServerValue.getFrontContextPath()%>/shopping/checkSpecInventoryBuyNowForPresent.do",{chkInveny:chkInveny}
								,function(result){	
									if(result!='OK'){// 赠品數量檢查
										alertDialog("库存不足",result,"",400,200);
									}else{
										$("#go_next").hide();
										$("#go_back").hide();
										$("#paymentInfoForm").submit();	
									}
								});	

								
							}			
						});	
				}
			});

			function saveInput(text, abId, iName, iProvince, iCity, iDistrict, iStreet, iZip, iMobile, iAreaCode, iPhone, iExte){
				var inputCorrect = true;
				var a_msg = new Array();
				a_msg[0]="true";

				a_msg[1]="";
				if(iName == "(请输入收货人姓名)"){
					a_msg[0]="false";
					a_msg[1]="请输入收件人姓名";
				}
				
				a_msg[2]="";
				if(iProvince == "请选择省"){
					a_msg[0]="false";
					a_msg[2]="请选择省";
				}

				if(iZip == ""){
					a_msg[0]="false";
					if(a_msg[2].length!=0){a_msg[2]+="，";}
					a_msg[2]+="请输入邮编";
				}
				
				if(iStreet == "(输入街道地址，例如：和平路12巷52号)"){
					a_msg[0]="false";
					if(a_msg[2].length!=0){a_msg[2]+="，";}
					a_msg[2]+="请输入街道";
				}

				a_msg[3]="";
				if(iMobile=="" && iPhone==""){
					a_msg[0]="false";
					a_msg[3]="请至少填写一组电话";
				}
				
				if(iPhone!="" && iAreaCode==""){
					a_msg[0]="false";
					a_msg[3]="请输入区码";
				}
				
				iStreet = iStreet.replace(/，/ig,",");
				a_msg[4] = iProvince+"，"+iCity+"，"+iDistrict+"，"+iStreet+"，"+iZip;
				if(a_msg[0]=="true"){
					a_msg[5] = "";		

					//can go next	
					return null;
				}else{
					return a_msg;
				}
			}	

			//計算实际应付总金额
			ProcessCalcuTotal();
			

			//處理帳戶餘額chkVrtBlnc	
			 $('#chkVrtBlnc').click(function(){	  
				 $("#subVrtlBlnc").css("background-color","white");	
	                if (this.checked){
	                	$("#useWallet").show();
	                	$("#subVrtlBlnc").attr("readOnly", false); 
	                	
	                	if($("#subVrtlBlnc").val()==""){
	                		$("#chkVrtBlnc").val(0.00);
	                		$("#subVrtlBlnc2").val(0.00);
		    			}else{
		    				 $("#chkVrtBlnc").val(parseFloat($("#subVrtlBlnc").val()).toFixed(2));
		    	             $("#subVrtlBlnc2").val(parseFloat($("#subVrtlBlnc").val()).toFixed(2)); 
		    			};
	                } else {
	                	initWallet();
	                	//$("#useWallet").hide();
	                	//$("#subVrtlBlnc").attr("readOnly", true);
	                	//$("#allpayed").hide();
	                	//$("#otherpayer").show(); 
	                	//$("#chkVrtBlnc").val(0.0);    
	                	////$("#subVrtlBlnc").val(0.0); 
	                	//$("#subVrtlBlnc2").val(0.0);  
	                };
	                ProcessCalcuTotal();
	        });	
		    $("#confirmWallet").click(function(){	  
		    	if($("#subVrtlBlnc").val()==""){
            		$("#chkVrtBlnc").val(0.00);
            		$("#subVrtlBlnc2").val(0.00);
    			}else{
    				 $("#chkVrtBlnc").val(parseFloat($("#subVrtlBlnc").val()).toFixed(2));
    	             $("#subVrtlBlnc2").val(parseFloat($("#subVrtlBlnc").val()).toFixed(2)); 
    			};                
                ProcessCalcuTotal();
                //alert($("#finalMustPay").val());
                var tmpSVB=0.00;
                if($("#subVrtlBlnc").val()==""){
            		tmpSVB=0.00;
    			}else{
    				tmpSVB=$("#subVrtlBlnc").val();
    			}
                
                if(parseFloat($("#finalMustPay").val())<0){
                    alert("折抵金额大於应付金额");
                    $("#subVrtlBlnc").focus();
                }else if(parseFloat(tmpSVB)>parseFloat($("#myVirtualBalance").text())){
					alert('账户余额不可大於目前我的账户余额');
					 $("#subVrtlBlnc").focus();
				}else if(parseFloat($("#finalMustPay").val())==0){
					$("#allpaymsg").show();    
                	$("input[id^='paytype']").each(function(i){
                    	//alert('in');
						if(this.id=='paytype40'){
							$(this).attr("disabled", false);
							$(this).attr("checked", true);
											
						}else{
							$(this).attr("disabled", true);
						}
					});
                	$("#useWallet").hide();
            		$("#subVrtlBlnc").attr("readOnly", true);
            		$("#subVrtlBlnc").css("background-color","silver");
                }else{  
					$("#useWallet").hide();
            		$("#subVrtlBlnc").attr("readOnly", true);
            		$("#subVrtlBlnc").css("background-color","silver");
                }
        	});	
		     
			//初始可折抵的購物金
			//processBonus(0);
				//一張訂單可使用多筆購物金，但最多只可折抵購買金額的<10>%
				//單日限折抵 <1000> 元，單筆限折抵 <200> 元
				//單日限折抵 <1000> 元 的method?? 單筆是指訂單？ 購買金額是指實際應付總額？
				function processBonus(minusCoupon){
					var iOffset=0;
					var iCanUse=$("#canUse").val();
					if(parseInt(iCanUse,10)>0){
						var ieditTotalAmount=$("#editTotalAmount").val();
						ieditTotalAmount=ieditTotalAmount-parseInt(minusCoupon,10);
						iOffset=Math.round(parseInt(ieditTotalAmount,10)*10/100);
						iOffset=parseInt(iOffset,10);
						if(iOffset>200){
							iOffset=200;
						}
						$("#offset").text(iOffset+"元");
						if($("#chkBonus").attr('checked')==true){
							$("#editBonus").val(parseFloat(iOffset).toFixed(2));		
						}
					}else{
						$("#offset").text(iOffset+"元");
						$("#chkBonus").attr('disabled',true); 
					}
				}
		
			$("#district").change(function() {
				initWallet();
				//判断是否可货到付款
				var tmpCity=$("#city").find('option:selected').val();
				var tmpDistrict=$("#district").find('option:selected').text();
				if(tmpDistrict.substring(0,1)=='※'){
					$("#paytype30").attr("disabled",false); 
					$("#showOrderPriceLimit").html("(需加收手续费 5 元，推广期暂不收。)");
				}else{
					$("#paytype30").attr("disabled",true);
					$("#paytype30").attr("checked",false);
					$("#showOrderPriceLimit").html("(需加收手续费 5 元，推广期暂不收。)");
				}
				if(parseFloat($("#finalTotalAmount").val())>2000){
					$("#paytype30").attr("disabled",true);
					$("#paytype30").attr("checked",false);
					$("#showOrderPriceLimit").html("(订单金额超过2000元，将不提供货到付款服务。)");
				}
				specialMessage();
				serviceSupportMessage();	
			});		
			$("#province").change(function() {
				initWallet();
				//计算运费
				var tmpProvince=$("#province").find('option:selected').val();
				//setTimeout(FreightCod,500);	
				FreightCod(tmpProvince);
			});	
				    
	});
	function FreightCod(tmpProvince){
		if(parseFloat($("#finalTotalAmount").val())>2000){
			$("#paytype30").attr("disabled",true);
			$("#paytype30").attr("checked",false);
			$("#showOrderPriceLimit").html("(订单金额超过2000元，将不提供货到付款服务。)");
			var tmpFinalMustPay=$("#editTotalAmount").val();
			var tmpIsBuyNow=$("#isBuyNow").val();
			var tmpChkInveny=$("#chkInveny").val();
			
			$.post("<%=ServerValue.getFrontContextPath()%>/shopping/orderInfo/getFreight.do",{codProvince:tmpProvince,isBuyNow:tmpIsBuyNow,finalMustPay:tmpFinalMustPay,chkInveny:tmpChkInveny},callback,"json");
		}else{
			var tmpDistrict=$("#district").find('option:selected').text();
			if(tmpDistrict.substring(0,1)=='※'){
				$("#paytype30").attr("disabled",false); 
				$("#showOrderPriceLimit").html("(需加收手续费 5 元，推广期暂不收。)");
			}else{
				$("#paytype30").attr("disabled",true); 
				$("#paytype30").attr("checked",false);
				$("#showOrderPriceLimit").html("(需加收手续费 5 元，推广期暂不收。)");
			}
			var tmpFinalMustPay=$("#editTotalAmount").val();
			var tmpIsBuyNow=$("#isBuyNow").val();
			var tmpChkInveny=$("#chkInveny").val();
			$.post("<%=ServerValue.getFrontContextPath()%>/shopping/orderInfo/getFreight.do",{codProvince:tmpProvince,isBuyNow:tmpIsBuyNow,finalMustPay:tmpFinalMustPay,chkInveny:tmpChkInveny},callback,"json");		
			clearTimeout;
		}
	}
	function callback(result){
		$("#spanFreight").text(result);
		//$("#editShipFare").val(result);
		$("#editShipFare").val(parseFloat(result).toFixed(2));
		ProcessCalcuTotal();
	}
	function ProcessCalcuTotal(){
		var sumAmount=0.00;
		$("input[id*='editAmount_']").each(function(){	
			sumAmount=parseFloat(sumAmount)+parseFloat($(this).val());
			sumAmount =sumAmount.toFixed(2);
		});
		$("#editTotalAmount").val(sumAmount);	//合计金额
		var finalTotalAmount=calcuTotal(sumAmount,$("#editShipFare").attr('value'),$("#editCoupon").attr('value'),$("#editBonus").attr('value'));
		$("#finalTotalAmount").val(finalTotalAmount);	//实际应付总金额-订单明细-关闭订单明细
		$("#pFinalTotalAmount").text(finalTotalAmount);//付款方式-订单金额
		$("#pTotalAmount").text($("#editTotalAmount").attr('value'));//付款方式-商品合计金额
		$("#pCoupon").text($("#editCoupon").attr('value'));//付款方式-礼券
		$("#pBonus").text($("#editBonus").attr('value'));//付款方式-购物金
		$("#pShipFare").text($("#editShipFare").attr('value'));//付款方式-运费
		var iMustPay=parseFloat(finalTotalAmount)-parseFloat($("#subVrtlBlnc2").val());
		iMustPay=iMustPay.toFixed(2);
		$("#finalMustPay").val(iMustPay);//剩余应付金额
		$("#closeFinalTotalAmount").val(iMustPay);	//实际应付总金额-订单明细-开启订单明细
		if(parseFloat($("#finalTotalAmount").val())>2000){
			$("#paytype30").attr("disabled",true);
			$("#paytype30").attr("checked",false);
			$("#showOrderPriceLimit").html("(订单金额超过2000元，将不提供货到付款服务。)");
		}else{
			var tmpDistrict=$("#district").find('option:selected').text();
			if(tmpDistrict.substring(0,1)=='※'){
				$("#paytype30").attr("disabled",false); 
				$("#showOrderPriceLimit").html("(需加收手续费 5 元，推广期暂不收。)");
			}else{
				$("#paytype30").attr("disabled",true); 
				$("#paytype30").attr("checked",false); 
			}
		}
	}
	function calcuTotal(sumAmount,shipFare,coupon,bonus){
		var fTotal=0.00;
		fTotal=parseFloat(sumAmount)+parseFloat(shipFare)-parseFloat(coupon)-parseFloat(bonus);
		fTotal =fTotal.toFixed(2);
		return fTotal;
	}
	function initWallet(){
		$("input[id*='paytype']").each(function(i){
			if(this.id=='paytype40'){
				$(this).attr("disabled", true);
				$(this).attr("checked", false);
								
			}else{
				$(this).attr("disabled", false);
			}
		});
		$("#useWallet").hide();
		$("#subVrtlBlnc").attr("readOnly", true); 
		$("#subVrtlBlnc").css("background-color","silver");

		$("#allpaymsg").hide();    	
    	//$("#otherpayed").show();

    	//$("#paytype40").attr("checked", false); 
    	
		$("#chkVrtBlnc").attr('checked', false);
		$("#chkVrtBlnc").val(0.0);  
    	
    	$("#subVrtlBlnc2").val(0.0);  
    	$("#subVrtlBlnc").val("");
		
        ProcessCalcuTotal();
		
	}
	function specialMessage(){
		
		var tmpDistrict = $("#district").find('option:selected').text();
		if(tmpDistrict=='※卢湾区' || tmpDistrict=='※黄浦区' || tmpDistrict=='※浦东新区'){
			 var msage="<p><strong>世博交通管制重要提醒：</strong></p>";
			 msage=msage+"<p>&nbsp;</p>";
			 msage=msage+"<p>2010/5/1～2010/10/31世博期间，因受世博会影响上海部分区域将被严格管制。受影响区域为<strong>卢湾</strong>、<strong>黄浦</strong>、<strong>浦东</strong>的部分区域即世博管制区（7km²），展会期间所有进入管制区的货物必须经过开箱检验。</p>";
			 msage=msage+"<p>&nbsp;</p>";
			 msage=msage+"<p>如您所在地点属管制区内，<span class='txt-rd'>您订购的货品可能有延迟送达、包装拆封或被没收等情形</span>，对于含有<span class='txt-rd'>膏状、乳状、液状</span>商品的订单或<span class='txt-rd'>单笔订单超过10kg</span>者，建议您修改订单内容以符合世博会管制要求，否则我们将无法为您送达。</p>";
			 msage=msage+"<p>&nbsp;</p>";
			 msage=msage+"<p>由此给您造成不便之处，敬请谅解！</p>";
			 msage=msage+"<p> 如需了解上述详细情况，可查阅<a href='/help/6_expo.html' target='_blank'>帮助中心</a>相关说明。</p>";
			alertDialog('注意事项', msage,"",460,320);
		}
	}	
	//是否耀点100货到付款支援区域
	function serviceSupportMessage(){
    	$('#dialog').addClass('ui-dialog-content ui-widget-content COD-area');
    	$.each(districtSvieArray,function(index, item){
			var selectDistrict =$("#district").find('option:selected').val();
			var chkPaytype30=$('input[id=paytype30]').is(":checked");
			if ( item.When == selectDistrict && chkPaytype30 == true ){
				var msage="<table class='tb-p01'>"; 
				msage=msage+"<tr>"; 
				msage=msage+"<th colspan='2'>县区</th>"; 
				msage=msage+"</tr>"; 
				msage=msage+"<tr>"; 
				msage=msage+"<td class='sec-th'>可服务区域</td> ";
				msage=msage+"<td>"+item.Value+"</td> ";
				msage=msage+"</tr> ";
				msage=msage+"<tr>"; 
				msage=msage+"<td class='sec-th'>不可服务区域</td>"; 
				msage=msage+"<td>"+item.Text+"</td>"; 
				msage=msage+"</tr>"; 
				msage=msage+" </table>"; 
				alertDialog('货到付款服务地区', msage,"",600,'auto');
			}
		});
	}	
</script>
<s:form action="paymentInfo/paymentInfoBuyNow.do" id="paymentInfoForm" name="paymentInfoForm" method="post">
<div id="container">	
   <div id="main">
   <div class="order-step"><img src="/images/orderstep_2.gif" alt="订购步骤2_填写订购信息" /></div>
<div class="payment">
    	<!-- 收货人 -->
        <h3>收货人信息 <span>  <a href="#" id="myAddBook">从收货地址簿选取</a></span><span>(<b class="txt-rd">*</b>为必填项目)</span></h3>
         <div class="consignee">
            <ul>
              <li class="w-1of1"><label for="name"><span class="txt-rd">*</span> 姓    名：</label><span>     
               <input type="text"  class="txt-gy" name="contactName" id="contactName" value="${lastAddressBook.contactName}" maxlength="20" size="10"/><br/>
              <span id="contactNameTip" class="msg rn" style="display:block;">请填写收货人</span>
              </span></li>
			  <li class="w-1of1">
                    <div><label><span class="txt-rd">*</span> 地    址：</label></div>
                    
                    
                    <div>省份：   <select id="province" name="province" class="c-prov">
				<option value="">== 选择省 ==</option>
			</select>市：
			<select id="city" name="city">
				<option value="">== 选择城市 ==</option>
			</select> 区：
			<select id="district" name="district">
				<option value="">== 选择地区 ==</option>
			</select><br/>
                  <span id="provinceTip" class="msg rn"></span><br/>
			  <p class="txt-gy">※号代表货到付款支持区域，具体服务范围以物流公司可实际到达范围为准。 </p>
              <br />
                      邮编： <input type="text" name="zipCode" id="zipCode" value="${lastAddressBook.zipCode}" size="6" maxlength="6"/>
                  街道： <input size="50" class="txt-gy" type="text" name="addr" id="addr" value="${lastAddressBook.addr}" /><br/>
                  <span id="addrTip" class="msg rn"></span>
                  </div>			
              </li>
              <li class="c-f">
                <label for="tel"><span  class="txt-rd">*</span>固定电话：</label>                
                <span> 
                <input type="text" name="areaCode" id="areaCode" value="${lastAddressBook.areaCode}" size="5" maxlength="4"/>-
		    <input type="text" name="phone" id="phone" value="${lastAddressBook.phone}" size="10" maxlength="10" maxlength="8"/>- 分机
 				<input type="text" name="extension" id="extension" value="${lastAddressBook.extension}" size="4" maxlength="8"/> 
                </span>&nbsp;<strong><span  class="txt-rd">*</span>手机号码：</strong>
                <input type="text" name="mobile" id="mobile"  value="${lastAddressBook.mobile}" size="18" maxlength="11"/>
                <span class="txt-ss">&nbsp;(<span  class="txt-rd">*</span>固定电话与手机需至少填写一区)</span>
                <br/>
                <span id="telTip" class="msg rn">请至少填写一组电话</span>
                 </li>
              <!-- <div><label>备    注：</label></div>
              <div>
              <textarea cols="25" rows="4" class="txt-gy" id="memo" name="memo"></textarea>            
              </div>
               -->                   
                <div class="paymentinvoice"> 
                    <p><strong>发票提醒</strong></p>  
                      <p>• 试营运期间，发票将于订单签收后10个工作日寄出。</p>
                      <p>• 企业客户若需增值税专用发票，<a href="/help/7_invoice.html" target="_blank">请向客服申请开具增值税发票。</a></p>
                </div>            
           </ul>
        </div>
       <!-- 配送方式 -->
          <h3>送货方式與运费说明</h3>
      <div class="send-way">
          <ul>
            <li class="w-1of3"><strong>运送方式：</strong>一般快递或EMS邮政快递</li>
            <li class="w-1of5"><strong>运费：<span class="txt-rd"><span id="spanFreight">0</span>元</span></strong>(<a href="#" id="payPortage">查看运费计算方式</a>)<br />
             <c-rt:set var="today" value="<%=new java.util.Date()%>" />
			<fmt:formatDate value="${today}" pattern="yyyyMMddHHmm" var="now"/>
            <c-rt:if test="${now<201006302359}"> 
              <br /><br /><p class="no-portage"><span>庆开站</span>购物满<b class="txt-rd">49元</b>，不限区域<b class="txt-rd">3KG</b>内免运费。(<a href="/act/mkt/0519_shipfree.html" target="_blank">活动详情</a>)</p>
            </c-rt:if> 
             </li>
          </ul>
      </div>
        <!-- 優惠方式 -->
          <h3>优惠折扣</h3>
        <div class="discount-way">
          <ul>
            <li class="w-1of3"><strong>可选择多项：</strong>
            <input type="hidden" id="showCpCode" name="couponInfo" value=""/>
            <input id="chkCoupon" name="chkCoupon" type="checkbox" value=""> 折扣礼券 (<a href="/help/3_coupons.html" target="_blank">礼券使用说明</a>)</li>
            <li class="w-1of5">
            <c:if test="${overOneThousand=='N'}">
            <input id="chkBonus" name="chkBonus" type="checkbox" value=""> 
            折抵购物金<strong class="txt-rd" id="offset">0元</strong> / 目前共有购物金<input type="hidden" id="canUse" value="${canUse}"><strong>${canUse}元</strong> (<a href="/help/3_coin.html" target="_blank">购物金使用说明</a>)
            </c:if>
            <c:if test="${overOneThousand=='Y'}">
            本日已超过1000元购物金，无法使用购物金
            </c:if>
            </li>
          </ul>
	    </div>
        <!-- 付款方式 -->
          <h3>付款方式</h3>
	  <div class="pay-way">
    		 <ul>
               <li class="w-1of1 pad">订单金额：
               <strong class="txt-rd">￥ <span id="pFinalTotalAmount"></span> 元</strong> 
               (＝商品合计金额<strong> <span id="pTotalAmount"></span> 元</strong>  + 运费<span id="pShipFare"></span>元 － 礼券<span id="pCoupon"></span>元 － 购物金<span id="pBonus"></span>元 )               
                </li>
               <li class="w-1of1 pad-1"><input id="chkVrtBlnc" name="chkVrtBlnc" type="checkbox" value="0.00" > 用我的账户余额 <input size="8" id="subVrtlBlnc" name="subVrtlBlnc"  value="" class="txt-rd" style="background-color:silver" readonly/>元来支付/目前我的账户余额为<strong>￥<span id="myVirtualBalance">${member.balance.virtualBalance}</span>元</strong> 
               <span id="useWallet" style="display:none;"><input type="button" id="confirmWallet" value="确认使用"/></span>
    		   </li>
    		   
    		  <li class="w-pay"><strong>请选择付款方式：</strong>
               <div style="display:none;"><input id="paytype40" name="paytype" type="radio" value="40">  <strong>全额由我的账户余额或礼券付清</strong></div>
               <div id="allpaymsg" style="display:none;"><strong class="txt-rd">本订单已由「账户余额」付清全额，您不需再选择付款方式。</strong></div>
    		  
    		   
    		   <div><input id="paytype50" name="paytype" type="radio" value="50">  <strong>网上支付</strong></div>
               <div><p><strong>银行支付：</strong></p></div>
               <div><span class="sub-bank">工商银行、农业银行、建设银行、交通银行、浦发银行、招商银行、广发银行</span></div>
                <div><p><strong>第三方支付：</strong></p></div>
               <div><span class="sub-bank">银联、财付通、快钱、支付宝</span></div>
               <div><input type="radio" id="paytype20" name="paytype" value="20"> <strong>邮局汇款</strong> <span class="txt-gy">(至邮局柜台汇款)</span></div>
               <div><input id="paytype10" name="paytype" type="radio" value="10"> <strong>银行转帐</strong> <span class="txt-gy">(至银行柜台汇款)</span></div>
               <div><input id="paytype30" name="paytype" type="radio" value="30">  <strong>货到付款</strong> <span class="txt-gy"></span><strong id="showOrderPriceLimit" class="txt-rd">(需加收手续费 5 元，推广期暂不收。)</strong></div>
               
    		   
           </ul>
      </div>
      
       <!-- 訂單明細close -->
       <div id="orderCartDetailClose">       
      <h3>订单明细<a id="orderCartToggleCloseName" href="javascript:;" class="a-more a-blue">开启订单明细</a></h3>
        <div  class="od-detail">
          <p class="total-1">本次订购共<span class="txt-rd">${countBuyNow}</span> 项商品，实际应付总金额：
          <span class="txt-rd">￥<input type="text" id="closeFinalTotalAmount" value=""  class="show-money txt-L">元</span></p>
		</div>		
		</div>
        <!-- 訂單明細 -->	
      
    
        <!-- 訂單明細open-->
         <div id="orderCartDetailOpen">  
      <h3>订单明细<a id="orderCartToggleOpenName" href="javascript:;" class="a-more a-blue">关闭订单明细</a><a name="detail"></a></h3>
		<div class="od-detail d-show"> 
	    <table class="tb-3"> 
	        <thead> 
	          <tr> 
	            <th width="500">商品名称</th>
	            <th width="50">类型</th>
	            <th width="70">属性</th>
	            <th width="85">单价</th>
	            <th width="50">数量</th>
	            <th width="85">小计</th>
	          </tr> 
	        </thead> 
	        <tbody>           
             			<c-rt:forEach items="${buyNowList}" var="buyNow" varStatus="rows_index">
				<c-rt:if test="${fn:split(buyNow, ',')[1]=='0' or fn:split(buyNow, ',')[1]=='1'}">
					<tr>
	        	<td colspan="5" align="left" class="table-in">
	          	<table border="0">
	            	<tr>
	            		<td width="500"><p>${fn:split(buyNow, ',')[0]}</p></td>
                  <td width="50">
                  	<span class="type-${fn:split(buyNow, ',')[1]}">${productTpMenu.options[fn:split(buyNow,',')[1]].name}</span>
                  </td>
                  <td width="70">${fn:split(buyNow, ',')[2]}</td>
                  <td width="85" class="txt-price">￥<fmt:formatNumber value="${fn:split(buyNow, ',')[3]}" pattern="#####0.00" /></td>
                  <td width="50">${fn:split(buyNow, ',')[4]}</td>
		            </tr>
		           </table>
							 <input type="hidden" id="editAmount_${rows_index.count}" name="editAmount_${rows_index.count}" value="${fn:split(buyNow, ',')[5]}" />
							 <input type="hidden" name="isBuyNow" id="isBuyNow" value="Y_${fn:split(buyNow, ',')[6]}_${fn:split(buyNow, ',')[4]}_${fn:split(buyNow, ',')[7]}" />
							 <input type="hidden" name="buyNowInfo" value="${buyNow}" />
							 <input type="hidden" id="chkInveny_${rows_index.count}" name="chkInveny" value="${fn:split(buyNow, ',')[6]}_${fn:split(buyNow, ',')[8]}_${fn:split(buyNow, ',')[4]}" />		           
		         </td>
		         <td>￥<fmt:formatNumber value="${fn:split(buyNow, ',')[5]}" pattern="#####0.00" /></td>
		       </tr>
				</c-rt:if>
				<c-rt:if test="${fn:split(buyNow, ',')[1]=='2'}">
					<tr>
	        	<td colspan="5" align="left" class="table-in">
	          	<table border="0">
	            	<tr>
                  <td width="500" class="txt-gy"><p>${fn:split(buyNow, ',')[0]}</p></td>
                  <td width="50"><span class="type-${fn:split(buyNow, ',')[1]}">${productTpMenu.options[fn:split(buyNow,',')[1]].name}</span></td>
                  <td width="70" class="txt-gy">&nbsp;</td>
                  <td width="85" class="txt-price">&nbsp;</td>
                  <td width="50" class="txt-gy">${fn:split(buyNow, ',')[4]}</td>
               	</tr>
              </table>
              <input type="hidden" id="editAmount_${rows_index.count}" name="editAmount_${rows_index.count}" value="${fn:split(buyNow, ',')[5]}" />
              <input type="hidden" name="buyNowInfo" value="${buyNow}" />
            </td>
            <td align="left" class="txt-price"></td>
          </tr>
				</c-rt:if>
				<c-rt:if test="${fn:split(buyNow, ',')[1]=='3'}">
					<tr>
	        	<td colspan="5" align="left" class="table-in">
	          	<table border="0">
	            	<tr>
                  <td width="500" class="txt-gy"><p>${fn:split(buyNow, ',')[0]}</p></td>
                  <td width="50"><span class="type-${fn:split(buyNow, ',')[1]}">${productTpMenu.options[fn:split(buyNow,',')[1]].name}</span></td>
                  <td width="70" class="txt-gy"></td>
                  <td width="85" class="txt-price">￥<fmt:formatNumber value="${fn:split(buyNow, ',')[3]}" pattern="#####0.00" /></td>
                  <td width="50" class="txt-gy">${fn:split(buyNow, ',')[4]}</td>
                </tr>
              </table>
             	<input type="hidden" id="editAmount_${rows_index.count}" name="editAmount_${rows_index.count}" value="${opd.amount*opd.qty}"/>
              <input type="hidden" id="editAmount_${rows_index.count}" name="editAmount_${rows_index.count}" value="${fn:split(buyNow, ',')[5]}" />
              <input type="hidden" name="buyNowInfo" value="${buyNow}" />
            </td>
            <td>￥<fmt:formatNumber value="${fn:split(buyNow, ',')[5]}" pattern="#####0.00" /></td>
					</tr>
				</c-rt:if>
				<c-rt:if test="${fn:split(buyNow, ',')[1]=='6'}">
					<tr>
	        	<td colspan="5" align="left" class="table-in">
	          	<table border="0">
	            	<tr>
                  <td width="500" class="${rows_index.count ne '1' ? 'txt-gy' : ''}"><p>${fn:split(buyNow, ',')[0]}</p></td>
                  <td width="50">
                  	<c-rt:if test="${rows_index.count eq '1'}">
											<span class="type-4">活动</span>
										</c-rt:if>
                  </td>
                  <td width="70" class="txt-gy">
                  	<c-rt:if test="${rows_index.count ne '1'}">${fn:split(buyNow, ',')[2]}</c-rt:if>
                  </td>
                  <td width="85" class="txt-price">
                  	<c-rt:if test="${rows_index.count eq '1'}">
                  		￥<fmt:formatNumber value="${fn:split(buyNow, ',')[3]}" pattern="#####0.00" />
                  	</c-rt:if>
                  </td>
                  <td width="50" class="txt-gy">${fn:split(buyNow, ',')[4]}</td>
                </tr>
              </table>
              <input type="hidden" id="editAmount_${rows_index.count}" name="editAmount_${rows_index.count}" value="${fn:split(buyNow, ',')[5]}" />
              <input type="hidden" name="buyNowInfo" value="${buyNow}" />
              <input type="hidden" name="isBuyNow" id="isBuyNow" value="Y_${fn:split(buyNow, ',')[6]}_${fn:split(buyNow, ',')[4]}_${fn:split(buyNow, ',')[7]}" />
            </td>
           	<td><c-rt:if test="${rows_index.count eq '1'}">￥<fmt:formatNumber value="${fn:split(buyNow, ',')[5]}" pattern="#####0.00" /></c-rt:if></td>	
				</c-rt:if>
			</c-rt:forEach>
               
            <input type="hidden" id="chkInveny" name="chkInveny" value="${chkInveny}"/>            
            <input type="hidden" id="addCmpPd" name="addCmpPd" value="${addCmpPd}"/> 
            </tbody>
            <tbody id="tCampP"></tbody>
        </table>
        <p class="total">本次订购共 <strong class="txt-rd">${countBuyNow}</strong> 项商品，合计金额：<span>￥<input type="text" id="editTotalAmount" name="editTotalAmount" value=""  class="show-money txt-bk" readonly="true">元</span></p>
        <p class="total">＋运费：<span>￥<input type="text" id="editShipFare" name="editShipFare" value="0.00" class="show-money txt-bk" readonly="true">元</span></p>
        <p class="total">＋货到付款手续费：<span>￥<input type="text"  value="0.00" class="show-money txt-bk" readonly="true">元</span></p>
        <p class="total">－抵扣礼券：<span>￥<input type="text" id="editCoupon" name="editCoupon" value="0.00" class="show-money txt-bk" readonly="true">元</span></p>
        <p class="total">－折抵购物金：<span>￥<input type="text" id="editBonus" name="editBonus" value="0" class="show-money txt-bk" readonly="true">元</span></p>
		<div class="total-line">
        <p class="total"><strong>订单金额：</strong><span>￥<input type="text" id="finalTotalAmount"  name="finalTotalAmount" value="0" class="show-money txt-bk" readonly="true" >元</span></p>
        <p class="total">－账户余额支付：<span>￥<input type="text" id="subVrtlBlnc2" value="0.00" class="show-money txt-bk" readonly="true" >元</span></p>
         </div>
        <p class="total txt-m"><strong class="txt-rd">剩余应付金额：</strong>
        <strong class="txt-rd">￥<input type="text" id="finalMustPay" name="finalMustPay" class="show-money txt-L" readonly="true" size="14"/>元</strong></p>
    </div>
    </div>
        <!-- 訂單明細 -->
        <p class="btns"><a id="go_next" href="javascript:void(0);" onclick=";return false;" class="btn-big-rd f-rt"><span>下一步</span></a><a id="go_back" href="<%=ServerValue.getFrontContextPath()%>/product/product.do?productId=<%=request.getParameter("itemNo")%>&z=<%=request.getParameter("categoryPath")%>" class="a-blue f-rt textlink" ><span>返回原商品页</span></a></p>  
  </div>
  </div> 
</div>
<div id="myAddBookDialog"></div> 
</s:form>
<div id="myCouponDialog"></div>
<div id="divPayArrive"></div>
<div id="divPayPortage"></div>
<div id="showWeightDialog"></div> 
<DIV id="dialog"></div>